<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>成绩判断</title>
	</head>
	<body>
		<input type="text" placeholder="请输入成绩" id="score">
		<button onclick="a()">点击</button>
		<p style="color: red;" id="txt">结果</p>
		
		<script>
			function a(){
				// 需求:
				// 根据输入框里面的值,进行成绩判断
				// 90-100  优秀
				// 80-90   良好
				// 60-80   合格
				// 小于60   不合格
				var score = document.getElementById("score").value;
				var p = document.getElementById("txt");
				
				if (score >= 90 && score <=100){
					p.innerHTML = "优秀";
				}else if (score >= 80 && score <90){
					p.innerHTML = "良好";
				}else if (score >= 60 && score <80){
					p.innerHTML = "合格";
				}else if (score <60){
					p.innerHTML = "不合格";
				}
				
			}
			
		</script>
	</body>
</html>
